<include file="public/header"/>
<div class="am-cf admin-main">
<!-- sidebar start -->
<include file="public/sidebar"/>
<!-- sidebar end -->

<!-- content start -->
<div class="admin-content">
<div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订金列表</strong></div>
    <div id="result"></div>
</div>

<div class="am-g">
    <div class="am-u-md-6 am-cf">
        <div class="am-fl am-cf">
            <div class="am-btn-toolbar am-fl">
                <div class="am-btn-group am-btn-group-xs">
                    <a href="{:U('User/lt2')}">
                        <button type="button" class="am-btn am-btn-primary am-btn-xs">
                            <span class="am-icon-plus"></span>新增
                        </button>
                    </a>
                    <!--belongGc-->
                    <if condition="$status eq 1">
                        <a id="getValue">
                            <button type="button" class="am-btn am-btn-success am-btn-xs">
                                批量分配工厂
                            </button>
                        </a>
                    </if>
                    <!--end-->
                    <!--psOrder-->
                    <if condition="$status eq 2">
                        <a id="getValuePs">
                            <button type="button" class="am-btn am-btn-success am-btn-xs">
                                批量配送
                            </button>
                        </a>
                    </if>
                    <!--end-->
                    <!--print-->
                    <if condition="$status eq 3">
                        <a id="getPrintValue">
                            <button type="button" class="am-btn am-btn-secondary am-btn-xs">
                                批量打印
                            </button>
                        </a>
                        <a id="getPsEndValue">
                            <button type="button" class="am-btn am-btn-success am-btn-xs">
                                批量完成配送
                            </button>
                        </a>
                    </if>
                    <!--end-->
                </div>
            </div>
        </div>
    </div>
    <form method="post" action="__URL__/orderSearch/id/{$status}" class="am-form">
        <div class="am-form-group am-margin-left am-fl">
            <select name="select" id="select">
                <option value="user">客户</option>
                <option value="phone">手机</option>
                <option value="lts">量体师</option>
            </select>
        </div>
        <div class="am-u-md-3 am-cf">
            <div class="am-fr">
                <div class="am-input-group am-input-group-sm">
                    <input type="text" class="am-form-field" name="ifin" id="ifin">
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="submit">搜索</button>
                </span>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="am-g">
    <div class="am-u-sm-12">
        <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
            <tr>
                <th class="table-check"><input type="checkbox" id="all"/></th>
                <th class="table-type">客户</th>
                <th class="table-type">手机</th>
                <th class="table-type">编号</th>
                <th class="table-id">数量</th>
                <th class="table-type">总金额</th>
                <th class="table-type">总定金</th>
                <th class="table-type">状态</th>
                <th class="table-type">工厂</th>
                <th class="table-set">操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="datas" item="data">
                 <tr>
                    <td><input type="checkbox" name="omid[]" class="check" value="{$data.omid}"/></td>
                    <td><a href="__URL__/../User/ltInfo/id/{$data.uid}">{$data.name}</a></td>
                    <td>{$data.phone}</td>
                     <td>{$data.order_num}</td>
                    <td>
                            {$data.num}
                    </td>
                    <td>{$data.price_count}</td>
                    <td>{$data.dj_count}</td>
                    <switch name="data.status">
                        <case value="1">
                            <td>新订单</td>
                        </case>
                        <case value="2">
                            <td>工厂完工</td>
                        </case>
                        <case value="3">
                            <td>待配送</td>
                        </case>
                        <case value="4">
                            <td>已配送</td>
                        </case>
                        <case value="5">
                            <td>返工单</td>
                        </case>
                        <default/>
                        <td>返工完工</td>
                    </switch>
                    <td>{$data.belong_gc}</td>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <!---订金确认start-->
                                    <a href="__URL__/firstPayType/id/{$data.omid}/type/1">
                                        <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                            <span class="am-icon-jpy"></span>
                                            现金
                                        </button>
                                    </a>
                                <a href="__URL__/orderBelongGc/id/{$data.omid}/type/2">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-success">
                                        <span class="am-icon-weixin"></span>
                                        微信
                                    </button>
                                </a>
                                <!---订金确认end-->
                            </div>
                        </div>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="am-cf">
            {$page}
        </div>
    </div>
</div>
</div>
<!-- content end -->
</div>
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
    function del() {
        if (!confirm("确认删除？")) {
            window.event.returnValue = false;
        }
    }
    function ps(id) {
        window.rs = id;
        document.getElementById(id).style.display = 'block';
        document.getElementById("p" + id).style.display = 'block';
    }
    $(function () {
        $("#close").click(function () {
            $(".shadow").css('display', 'none');
            $(".popbox").fadeOut('fast');
        });
    })
    $("#all").click(function () {
        if (this.checked) {
            $(".check").attr("checked", true);
        } else {
            $(".check").attr("checked", false);
        }
    });
    //    批量分配工厂ajax
    $("#getValue").click(function () {
        var arr = new Array;
        $("input[name='omid[]']:checked").each(function () {
            arr.push($(this).val());
        });
        $.post(
                "http://001.hitailor.com/Batch/batchGet",
                {"omids": arr},
                function (data) {
                    window.location.href = "http://001.hitailor.com/Batch/batchBelongGc/ids/" + data.content;
                }
        );
    });
    //    批量打印ajax
    $("#getPrintValue").click(function () {
        var arr = new Array;
        $("input[name='omid[]']:checked").each(function () {
            arr.push($(this).val());
        });
        $.post(
                "http://001.hitailor.com/Batch/batchGet",
                {"omids": arr},
                function (returnData) {
                    if (returnData.status == 1) {
                        window.location.href = "http://001.hitailor.com/Batch/batchPrint2/id/" + returnData.content;
                    } else {
                        alert(returnData.content);
                    }
                }
        );
    });
    //批量完成配送AJAX
    $("#getPsEndValue").click(function () {
        var arr = new Array;
        $("input[name='omid[]']:checked").each(function () {
            arr.push($(this).val());
        });
        $.post(
                "http://001.hitailor.com/Batch/batchGet",
//                "http://localhost/thinkphp/index.php/Admin/Batch/batchGet",
                {"omids": arr},
                function (returnData) {
                    window.location.href = "http://001.hitailor.com/Batch/batchPsEnd/id/" + returnData.content;
//                        window.location.href="http://localhost/thinkphp/index.php/Admin/Batch/batchPsEnd/id/"+returnData.content;
                }
        );
    });
    //批量配送AJAX
    $("#getValuePs").click(function () {
        var arr = new Array;
        $("input[name='omid[]']:checked").each(function () {
            arr.push($(this).val());
        });
        $.post(
                "http://001.hitailor.com/Batch/batchGet",
//                "http://localhost/thinkphp/index.php/Admin/Batch/batchGet",
                {"omids": arr},
                function (returnData) {
                    window.location.href = "http://001.hitailor.com/Batch/batchPs/ids/" + returnData.content;
//                        window.location.href="http://localhost/thinkphp/index.php/Admin/Batch/batchPs/ids/"+returnData.content;
                }
        );
    });
</script>
<include file="public/footer"/>